﻿/*
{
"状态":1,
"名称":"更新-字典信息",
"作者":"陈泽椿",
"创建时间":"2018-06-30",
"功能":"更新-字典信息",
"log": [
	{"date":"06-01" , "dev" :"hzhh" , "content" : ""}
]
}
*/
declare @dict_key varchar(100),@detail_name varchar(100) ,@dict_id varchar(100)
set @dict_key = '{dict_key}'
set @detail_name = '{detail_name}'
set @dict_id = '{dict_id}'

--校验信息
if isnull(@detail_name,'')=''
begin 
	RAISERROR ('SQL:字典名称不允许为空', 16 ,1 ) ; 
	return 
end 

if EXISTS(SELECT * FROM y_dict WHERE [dict_key]=@dict_key and [dict_id] <> @dict_id and  detail_name=@detail_name)
begin
	RAISERROR ('SQL:字典名称已经存在', 16 ,1 ) ; 
	return 
end

update [dbo].[y_dict] set
[detail_name] = @detail_name ,
[update_time] = getdate()
where [dict_key] = @dict_key
and [dict_id] = @dict_id
